package com.xu.minio;

import com.xu.minio.prop.MinioProperties;
import io.minio.MinioClient;
import jakarta.annotation.Resource;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;


/**
 * minio自动装配类
 *
 * @Author: 许乾伟
 * @Date: 2024/3/8 11:44
 */
@EnableConfigurationProperties({ MinioProperties.class })
public class EnableAutoConfiguration {
    @Resource
    MinioProperties properties;
    @Bean
    public MinioClient minioClient(){
        return MinioClient.builder()
                .endpoint(properties.getEndpoint())
                .credentials(properties.getAccessKey(), properties.getSecretKey())
                .build();
    }
}
